const initialState = {
  appVersion: '',
  jsVersion: '',
  brand: '',
  osVersion: '',
  deviceId: '',
  timestamp: '',
};

export const DeviceActions = {
  DEVICE_UPDATE: 'device_update',
};

export function updateDevice(payload) {
  return {
    type: DeviceActions.DEVICE_UPDATE,
    payload,
  };
}

export default function device(state = initialState, action) {
  switch (action.type) {
    case DeviceActions.DEVICE_UPDATE:
      return {...state, ...action.payload};
    default:
      return state;
  }
}
